<template>
    <view class='bargain-list' >
		<view class='iconfont icon-xiangzuo' @tap='goBack' :style="'top:'+navH/2+'rpx'"></view>
		<view class="content-cert"   >
			<!-- <view class="title"> {{title}}</view> -->
			<!-- <view class="close-btn" @tap= "$refs.tipContent.close()">x</view> -->
			<view v-for="item in data.list" >
				<image :src="item.src" mode="widthFix" style="width: 750rpx;"></image>
			</view>
		</view>	
		
		<uni-popup-vlogin id="popupvLogin" ref="popupvLogin" type="bottom" />
    </view>
	

    
</template>

<script>
   
	import {oss_host} from '@/config/config.js';
	import store from '@/store/index.js';
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
    //获取网络状态
    import {
        mapGetters
    } from 'vuex';
    export default {
        data() {
            return {
                isSelect: false,
                //网络状态
                networkStatus: true,
				OSS_HOST: oss_host,
				title:'',
				color:'#FF7A47',//背景颜色
                //接口数据
                // bargainList:[],
                data:{
                    bargainList:[
						
						
					],
					list:[],
                    page:0,
                    lastPage:0,
					userInfo:{},
                },
				activityBanner:'',
                limit:20,
                loading:false,
                loadend:false,
               
                navH:''
            };
        },
        components: {
			uniPopup
        },
        computed: {
            //注册网络状态
            ...mapGetters(['netWorkType','loginStatus'])
        },
        onShow() {
            // this.getList()
        },

        onLoad(e) {
           // console.log('*****e:',e)
		  
		   if( e.title!='undefined'){
			   this.title = e.title
			   uni.setNavigationBarTitle({
			   	title: e.title,
			   })
			   uni.setNavigationBarColor({
			   	// frontColor: '#ffffff',
			   	backgroundColor: '#ffffff',
			   })
			 
		   }
		   // if(e.list !='undefined'){
			  //  this.data.list = JSON.parse(e.list)
		   // }
		   
		  
            this.getList();
			
            // this.userInfo=e.detail

        },
		onReachBottom(){
			 // 分页 上拉加载
			 // console.log(this.data.page,this.data.lastPage)
			if (this.data.page >= this.data.lastPage) {
				// console.log(1111111)
				uni.showToast({
					icon: 'none',
					title: '没有更多数据'
				});
				return;
			}
		  
		  // this.getList();
		  
		},
        methods: {
            // 刷新的方法
            refresh() {
                this.getList()
            },
             goBack(){
                uni.navigateBack({ delta: 1 })
              },
            getList(){
                let that = this;
				let is_hot = 1
				let property = ''
				if(this.title == '每日特价'){
					is_hot = 1
				}else{
					property =87
				}
				
                 var opt = {
                    url: '/index/index',
                    data:{
                       
                    },
                    success: function(res) {
                        //console.log(res)
                        if (res.status == 1) {

                            that.data.list=res.data.cert
                          
							
							// console.log(that.activityBanner)
						} else {
                            uni.showToast({
                                icon: 'none',
                                title: res.message
                            });
                        }

                    }
                };
                that.$service.GetApi(opt)




              },
           
            toDetail() {
                const _this = this

                _this.$refer.setVilit('/pages/address/add/add')
                let callback = function(url) {
                    _this.$refs.popupvLogin.open()
                }
                var data = {
                    type: 'add'
                }
                _this.$refer.toUrl(callback, data)
            },
            openSubscribe(id){
				const _this = this
				if(!_this.loginStatus){
					_this.$refs.popupvLogin.open()
					return
				}
				// console.log(23)
				_this.$refer.setVilit('/pages/GoodsDetails/GoodsDetails')
				let callback = function(url) {
				    // _this.$refs.popupvLogin.open()
				}
				var data = {
				    id: id, //
					// bargainUid:_this.data.userInfo.id,
					
				}
				_this.$refer.toUrl(callback, data)
            },
            select(row) {
                //是否需要返回地址(从订单确认页跳过来选收货地址)
                if (!this.isSelect) {
                    return;
                }
                uni.setStorage({
                    key: 'selectAddress',
                    data: row,
                    success() {
                        uni.navigateBack();
                    }
                })
            }
        }
    }
</script>

<style lang="scss">
    @import "./index.scss";
	
</style>
